package logic

import (
	"context"
	"errors"
	"user_srv/internal/dao"

	"user_srv/internal/svc"
	"user_srv/user"

	"github.com/zeromicro/go-zero/core/logx"
)

type GetAchievementListLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewGetAchievementListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetAchievementListLogic {
	return &GetAchievementListLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *GetAchievementListLogic) GetAchievementList(in *user.GetAchievementListRequest) (*user.GetAchievementListResponse, error) {
	// todo: add your logic here and delete this line
	list, err := dao.GetAchievementList(in)
	if err != nil {
		return nil, errors.New("个人成就展示成功")
	}
	return &user.GetAchievementListResponse{
		List: list,
	}, nil
}
